<template>
  <div class="lzhisfl">
    <h7>行政领导职数</h7>
    <ul class="adzhis">
      <li>
        <p>领导职数核定</p>
        <p @click="xzbzLdzs()">{{ ldzshd }}</p>
      </li>
      <li>
        <p>领导职数实配</p>
        <p @click="xzzzLdzs()">{{ ldzssp }}</p>
      </li>
    </ul>
  </div>
  <el-dialog
  :draggable="true"
    :title="ldzsTitle"
    v-model="dialogVisible"
    width="50%"
    destroy-on-close
  >
    <!-- <div class="mg-chart" ref="mgcharts"></div> -->
    <XzjgLdzsChild
	@updateTitle="updateTitle"
      :depCode="depCode"
      :ldzstype="ldzstype"
    ></XzjgLdzsChild>
  </el-dialog>
  
 
</template>

<script>
import Sever from "@/api/selfApi";
import XzjgLdzsChild from "@/components/home/XzjgLdzsChild";
export default {
  name: "HomeRightXzjgLdzs",
  data() {
    return {
      ldzshd: 0,
      ldzssp: 0,
	  depCode:"36%",
	  ldzstype:"",
	  ldzsTitle: "",
	  dialogVisible: false,
    };
  },
  computed: {
    changeData() {
      return this.$store.state.depCode;
    },
  },
  mounted() {
    this.refreshData("36%");
  },
  components:{
	  Sever,
	  XzjgLdzsChild
  },
  watch: {
    changeData: {
      handler(newV) {
        this.refreshData(newV);
      },
    },
  },
  methods: {
    async refreshData(depCode) {
      await Sever.smz
        .getXzldzs({ depCode: depCode })
        .then((res) => {
          if (res.code == 1) {
            this.ldzshd = res.data.ldbz;
            this.ldzssp = res.data.ldzz;
			this.depCode=depCode;
          } else {
            console.log("xzjgldzs请求错误！");
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
	
	xzbzLdzs() {
		this.ldzstype="bz";
		this.ldzsTitle="行政领导职数核定详情"
	  this.dialogVisible = true;
	},
	
	
	xzzzLdzs() {
		this.ldzstype="zz";
		this.ldzsTitle="行政领导职数实配详情"
	  this.dialogVisible = true;
	},
	
	updateTitle(val){
		this.ldzsTitle=val+"详情";
		
	}
	
	
	
  },
};
</script>